﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SchemaExplorer;
using CodeSmith.SchemaHelper;
using System.Diagnostics;

namespace CodeSmith.QuickStart.Util
{
    public sealed class TargetObjectSet
    {
        private static TargetObjectSet _instance;
        public static TargetObjectSet Instance
        {
            get
            {
                return _instance;
            }
        }

        public bool CanGenChildList(Association association)
        {
            /// TODO:
            return true;
            bool result = false;

            if (EditableChild != null && EditableChildList != null)
            {
                if (EditableChild.Contains(association.TableKey) && EditableChildList.Contains(association.TableKey))
                {
                    result = true;
                }
            }

            if (!result)
            {
                if (ReadOnlyChild != null && ReadOnlyChildList != null)
                {
                    if (ReadOnlyChild.Contains(association.TableKey) && ReadOnlyChildList.Contains(association.TableKey))
                    {
                        result = true;
                    }
                }
            }
            return result;
        }

        private TargetObjectSet() 
        {
            
        }

        static TargetObjectSet()
        {
            _instance = new TargetObjectSet();
        }
        #region  Entities

        

        public TableSchemaCollection CommandObject { get; set; }

        

        public TableSchemaCollection Criteria { get; set; }

        

        public TableSchemaCollection DynamicRoot
        {
            get;
            set;
        }

        

        public TableSchemaCollection EditableChild
        {
            get;
            set;
        }

        

        public TableSchemaCollection EditableRoot
        {
            get;
            set;
        }

        

        public TableSchemaCollection ReadOnlyChild
        {
            get;
            set;
        }

        

        public TableSchemaCollection ReadOnlyRoot
        {
            get;
            set;
        }

        

        public TableSchemaCollection SwitchableObject
        {
            get;
            set;
        }

        #endregion

        #region 6b. List Entities

        public TableSchemaCollection DynamicListBase
        {
            get;
            set;
        }

        public TableSchemaCollection DynamicRootList
        {
            get;
            set;
        }

        public TableSchemaCollection EditableRootList
        {
            get;
            set;
        }

        public TableSchemaCollection EditableChildList
        {
            get;
            set;
        }


        public TableSchemaCollection ReadOnlyList
        {
            get;
            set;
        }

        public TableSchemaCollection ReadOnlyChildList
        {
            get;
            set;
        }

        public TableSchemaCollection NameValueList
        {
            get;
            set;
        }

        #endregion
    }
}
